﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:System="clr-namespace:System;assembly=mscorlib"
                    xmlns:Controls="clr-namespace:MahApps.Metro.Controls">

    <!-- ********************************** RadioButton Style **********************************-->
    <!-- adapted from http://brianlagunas.com/free-metro-light-and-dark-themes-for-wpf-and-silverlight-microsoft-controls/ -->
    <Style x:Key="MetroRadioButton"
           TargetType="RadioButton">
        <Setter Property="Foreground"
                Value="{DynamicResource LabelTextBrush}" />
        <Setter Property="FontSize"
                Value="{DynamicResource ContentFontSize}" />
        <Setter Property="FontFamily"
                Value="{DynamicResource ContentFontFamily}" />
        <Setter Property="HorizontalContentAlignment"
                Value="Left" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="Padding"
                Value="6,0,0,0" />
        <Setter Property="BorderThickness"
                Value="1" />
        <Setter Property="Controls:ControlsHelper.FocusBorderBrush"
                Value="{DynamicResource HighlightBrush}" />
        <Setter Property="Controls:ControlsHelper.MouseOverBorderBrush"
                Value="{DynamicResource CheckBoxMouseOverBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="RadioButton">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         To=".55"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         Storyboard.TargetName="contentPresenter" />
                                        <DoubleAnimation Duration="0"
                                                         To="1"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         Storyboard.TargetName="disabled" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <DoubleAnimation Duration="0"
                                                         To="1"
                                                         Storyboard.TargetProperty="(UIElement.Opacity)"
                                                         Storyboard.TargetName="Checked1" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked" />
                                <VisualState x:Name="Indeterminate" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="18" x:Name="LeftCol" />
                            <ColumnDefinition Width="*" x:Name="RightCol" />
                        </Grid.ColumnDefinitions>
                        <Grid x:Name="PART_CHECKBOX">
                            <Rectangle Fill="{DynamicResource TransparentWhiteBrush}"
                                       Margin="-6,0" />
                            <Ellipse x:Name="normal"
                                     Stroke="{DynamicResource CheckBoxBrush}"
                                     StrokeThickness="1"
                                     Fill="{DynamicResource WhiteBrush}"
                                     Width="18"
                                     Height="18" />
                            <Ellipse x:Name="Checked1"
                                     Fill="{DynamicResource HighlightBrush}"
                                     Opacity="0"
                                     Width="10"
                                     Height="10" />
                            <Ellipse x:Name="disabled"
                                     Opacity="0"
                                     StrokeThickness="1"
                                     Fill="{DynamicResource SemiTransparentWhiteBrush}"
                                     Width="18"
                                     Height="18" />
                        </Grid>
                        <ContentPresenter x:Name="contentPresenter"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          Content="{TemplateBinding Content}"
                                          RecognizesAccessKey="True"
                                          Grid.Column="1"
                                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver"
                                 Value="True">
                            <Setter TargetName="normal"
                                    Property="Stroke"
                                    Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.MouseOverBorderBrush)}" />
                        </Trigger>
                        <Trigger Property="IsPressed"
                                 Value="True">
                            <Setter TargetName="normal"
                                    Property="Stroke"
                                    Value="{DynamicResource HighlightBrush}" />
                        </Trigger>
                        <Trigger Property="IsFocused"
                                 Value="True">
                            <Setter TargetName="normal"
                                    Property="Stroke"
                                    Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.FocusBorderBrush)}" />
                        </Trigger>
                        <Trigger Property="Controls:ToggleButtonHelper.ContentDirection"
                                 Value="RightToLeft">
                            <Setter Property="Padding"
                                    Value="0,0,6,0" />
                            <Setter TargetName="LeftCol"
                                    Property="Width"
                                    Value="*" />
                            <Setter TargetName="RightCol"
                                    Property="Width"
                                    Value="18" />
                            <Setter TargetName="PART_CHECKBOX"
                                    Property="Grid.Column"
                                    Value="1" />
                            <Setter TargetName="contentPresenter"
                                    Property="Grid.Column"
                                    Value="0" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
